﻿// <copyright file="DomainsGM.cs" company="Gravity Age Studios">
// Code released under the MIT license (see License.txt).
// </copyright>
// <author>Vicente Cartas Espinel</author>
// <email>vicente.cartas@gmail.com</email>
namespace LightSwitchApplication
{
    using System;
    using LightSwitchApplication.Export;
    using LightSwitchApplication.Import;

    public partial class DomainsGM
    {
        #region Add/Edit Domain

        partial void gridAddAndEditNew_Execute()
        {
            this.Application.ShowDomainAddEditGM(null);
        }

        partial void gridEditSelected_CanExecute(ref bool result)
        {
            result = this.Collection.SelectedItem != null;
        }

        partial void gridEditSelected_Execute()
        {
            this.Application.ShowDomainAddEditGM(this.Collection.SelectedItem.Id);
        }

        #endregion

        partial void ImportDomains_Execute()
        {
            ImporterHelper.ImportDomains(this.DataWorkspace, this.Collection);
        }

        partial void ImportProvincesData_Execute()
        {
            ImporterHelper.ImportDomainProvincesData(this.DataWorkspace);
        }

        partial void ExportDomains_Execute()
        {
            Exporter.ExportDomains(this.Collection);
        }

        partial void ExportProvinces_Execute()
        {
            Exporter.ExportDomainProvincesData(this.Collection);
        }
    }
}
